/**
 * Created by baidm in 2022/5/5 on 21:55
 */
import MapDemoConst from "@/const/MapDemoConst"
import {ref} from "vue"
import {openWindow} from "@/hooks/useCommon"
import {useRouter} from "vue-router";

export default function () {
    const router = useRouter()

    let menuStatusRef = ref(true);
    let mapDemoListRef = ref([
        {name: "添加 marker", id: MapDemoConst.ADD_MARKER},
        {name: "添加 image marker", id: MapDemoConst.ADD_IMAGE_MARKER},
        {name: "添加 merge image marker", id: MapDemoConst.ADD_MERGE_IMAGE_MARKER},
        {name: "添加 circle marker", id: MapDemoConst.ADD_CIRCLE_MARKER},
        {name: "添加 vector marker", id: MapDemoConst.ADD_VECTOR_MARKER},
        {name: "添加 marker rightmenu", id: MapDemoConst.ADD_MARKER_RIGHTMENU},
        {name: "添加 marker infowindow", id: MapDemoConst.ADD_MARKER_INFOWINDOW},
        {name: "添加 line", id: MapDemoConst.ADD_LINE},
        {name: "添加 gradient line", id: MapDemoConst.ADD_GRADIENT_LINE},
        {name: "添加 line with direction marker", id: MapDemoConst.ADD_LINE_WITH_DIRECTION_MARKER},
        {name: "添加 smoothness line", id: MapDemoConst.ADD_SMOOTHNESS_LINE},
        {name: "添加 polygon", id: MapDemoConst.ADD_POLYGON},
        {name: "添加 marker wave", id: MapDemoConst.ADD_MARKER_WAVE},
        {name: "添加 UI marker", id: MapDemoConst.ADD_UI_MARKER},
        {name: "添加 UI echarts pie", id: MapDemoConst.ADD_UI_ECHARTS_PIE},
        {name: "添加 UI echarts graph", id: MapDemoConst.ADD_UI_ECHARTS_GRAPH},
        {name: "添加 layer mask", id: MapDemoConst.ADD_LAYER_MASK},
        {name: "筛选 polygon", id: MapDemoConst.FILTER_POLYGON},
        {name: "设置 图层层级", id: MapDemoConst.SET_LAYER_INDEX},
        {name: "添加 粒子图层", id: MapDemoConst.ADD_PARTICLE_LAYER},
        {name: "添加 image layer", id: MapDemoConst.ADD_IMAGE_LAYER},
        {name: "添加 鱼鹰眼", id: MapDemoConst.ADD_MAGNIFIER},
        {name: "添加 distance tool", id: MapDemoConst.ADD_DISTANCE_TOOL},
        {name: "添加 area tool", id: MapDemoConst.ADD_AREA_TOOL},
        {name: "添加 draw tool", id: MapDemoConst.ADD_DRAW_TOOL},
        {name: "添加 draggabled", id: MapDemoConst.ADD_DRAGGABLED},
        {name: "添加 editeabled", id: MapDemoConst.ADD_EDITABLED},
        {name: "添加 animated marker", id: MapDemoConst.ADD_ANIMATED_MARKER},
        {name: "添加 animated line", id: MapDemoConst.ADD_ANIMATED_LINE},
        {name: "添加 animated polygon", id: MapDemoConst.ADD_ANIMATED_POLYGON},
        {name: "添加 animated custom", id: MapDemoConst.ADD_ANIMATED_CUSTOM},
        {name: "添加 全屏", id: MapDemoConst.ADD_FULLSCREEN},
        {name: "添加 heat layer", id: MapDemoConst.ADD_HEAT_LAYER},
        {name: "添加 cluster marker", id: MapDemoConst.ADD_CLUSTER_MARKER},
        {name: "添加 animate marker", id: MapDemoConst.ADD_ANIMATE_MARKER},
        {name: "添加 odline migration", id: MapDemoConst.ADD_ODLINE_MIGRATION},
        {name: "添加 odline curves", id: MapDemoConst.ADD_ODLINE_CURVES},
        {name: "添加 echarts bus", id: MapDemoConst.ADD_ECHARTS_BUS},
        {name: "添加 echarts fly", id: MapDemoConst.ADD_ECHARTS_FLY},
        {name: "添加 windy layer", id: MapDemoConst.ADD_WINDY_LAYER},
        {name: "添加 isects", id: MapDemoConst.ADD_ISECTS},
        {name: "添加 toolbar", id: MapDemoConst.ADD_TOOLBAR},
        {name: "添加 route play", id: MapDemoConst.ADD_ROUTE_PLAY},
        {name: "添加 route play multi", id: MapDemoConst.ADD_ROUTE_PLAY_MULTI},
    ]);

    //切换展示demo
    const toggleMapDemo = (menu) => {
        switch (menu.id) {
            case MapDemoConst.ADD_MARKER:
                openWindow(router, "addMarker")
                break;
            case MapDemoConst.ADD_IMAGE_MARKER:
                openWindow(router, "addImageMarker")
                break;
            case MapDemoConst.ADD_MERGE_IMAGE_MARKER:
                openWindow(router, "AddMergeImageMarker")
                break;
            case MapDemoConst.ADD_CIRCLE_MARKER:
                openWindow(router, "addCircleMarker")
                break;
            case MapDemoConst.ADD_VECTOR_MARKER:
                openWindow(router, "addVectorMarker")
                break;
            case MapDemoConst.ADD_MARKER_RIGHTMENU:
                openWindow(router, "addMarkerRightmenu")
                break;
            case MapDemoConst.ADD_MARKER_INFOWINDOW:
                openWindow(router, "addMarkerInfowindow")
                break;
            case MapDemoConst.ADD_LINE:
                openWindow(router, "addLine")
                break;
            case MapDemoConst.ADD_GRADIENT_LINE:
                openWindow(router, "addGradientLine")
                break;
            case MapDemoConst.ADD_LINE_WITH_DIRECTION_MARKER:
                openWindow(router, "addLineWithDirectionMarker")
                break;
            case MapDemoConst.ADD_SMOOTHNESS_LINE:
                openWindow(router, "addSmoothnessLine")
                break;
            case MapDemoConst.ADD_POLYGON:
                openWindow(router, "addPolygon")
                break;
            case MapDemoConst.ADD_MARKER_WAVE:
                openWindow(router, "addMarkerWave")
                break;
            case MapDemoConst.ADD_UI_MARKER:
                openWindow(router, "addUIMarker")
                break;
            case MapDemoConst.ADD_UI_ECHARTS_PIE:
                openWindow(router, "addUIEchartsPie")
                break;
            case MapDemoConst.ADD_UI_ECHARTS_GRAPH:
                openWindow(router, "addUIEchartsGraph")
                break;
            case MapDemoConst.ADD_LAYER_MASK:
                openWindow(router, "addLayerMask")
                break;
            case MapDemoConst.FILTER_POLYGON:
                openWindow(router, "filterPolygon")
                break;
            case MapDemoConst.SET_LAYER_INDEX:
                openWindow(router, "setLayerIndex")
                break;
            case MapDemoConst.ADD_PARTICLE_LAYER:
                openWindow(router, "addParticleLayer")
                break;
            case MapDemoConst.ADD_IMAGE_LAYER:
                openWindow(router, "addImageLayer")
                break;
            case MapDemoConst.ADD_MAGNIFIER:
                openWindow(router, "addMagnifier")
                break;
            case MapDemoConst.ADD_DISTANCE_TOOL:
                openWindow(router, "addDistanceTool")
                break;
            case MapDemoConst.ADD_AREA_TOOL:
                openWindow(router, "addAreaTool")
                break;
            case MapDemoConst.ADD_DRAW_TOOL:
                openWindow(router, "addDrawTool")
                break;
            case MapDemoConst.ADD_DRAGGABLED:
                openWindow(router, "addDraggabled")
                break;
            case MapDemoConst.ADD_EDITABLED:
                openWindow(router, "addEditabled")
                break;
            case MapDemoConst.ADD_ANIMATED_MARKER:
                openWindow(router, "addAnimatedMarker")
                break;
            case MapDemoConst.ADD_ANIMATED_LINE:
                openWindow(router, "addAnimatedLine")
                break;
            case MapDemoConst.ADD_ANIMATED_POLYGON:
                openWindow(router, "addAnimatedPolygon")
                break;
            case MapDemoConst.ADD_ANIMATED_CUSTOM:
                openWindow(router, "addAnimatedCustom")
                break;
            case MapDemoConst.ADD_FULLSCREEN:
                openWindow(router, "addFullscreen")
                break;
            case MapDemoConst.ADD_HEAT_LAYER:
                openWindow(router, "addHeatLayer")
                break;
            case MapDemoConst.ADD_CLUSTER_MARKER:
                openWindow(router, "addClusterMarker")
                break;
            case MapDemoConst.ADD_ANIMATE_MARKER:
                openWindow(router, "addAnimateMarker")
                break;
            case MapDemoConst.ADD_ODLINE_MIGRATION:
                openWindow(router, "addOdlineMigration")
                break;
            case MapDemoConst.ADD_ODLINE_CURVES:
                openWindow(router, "addOdlineCurves")
                break;
            case MapDemoConst.ADD_ECHARTS_BUS:
                openWindow(router, "addEchartsBus")
                break;
            case MapDemoConst.ADD_ECHARTS_FLY:
                openWindow(router, "addEchartsFly")
                break;
            case MapDemoConst.ADD_WINDY_LAYER:
                openWindow(router, "addWindyLayer")
                break;
            case MapDemoConst.ADD_ISECTS:
                openWindow(router, "addIsects")
                break;
            case MapDemoConst.ADD_TOOLBAR:
                openWindow(router, "addToolbar")
                break;
            case MapDemoConst.ADD_ROUTE_PLAY:
                openWindow(router, "addRoutePlay")
                break;
            case MapDemoConst.ADD_ROUTE_PLAY_MULTI:
                openWindow(router, "addRoutePlayMulti")
                break;
        }
    }

    return {
        menuStatusRef, mapDemoListRef, toggleMapDemo
    }
}
